Skip to content

Conversation

@bso-odoo
Copy link
Collaborator

@bso-odoo bso-odoo commented Dec 26, 2022

See odoo/odoo#104836

task-2963840

@robodoo
Copy link
Collaborator

robodoo commented Dec 26, 2022

@bso-odoo bso-odoo force-pushed the 15.0-assets_ignore_active-bso branch 2 times, most recently from f1beec2 to ba52ef1 Compare December 26, 2022 12:15
@bso-odoo bso-odoo marked this pull request as ready for review December 26, 2022 12:54
@bso-odoo bso-odoo force-pushed the 15.0-assets_ignore_active-bso branch from ba52ef1 to 796fb28 Compare January 4, 2023 15:45
@bso-odoo bso-odoo force-pushed the 15.0-assets_ignore_active-bso branch from 796fb28 to b2dd9b5 Compare November 29, 2023 09:13
@qsm-odoo qsm-odoo marked this pull request as draft October 16, 2025 14:53
@qsm-odoo qsm-odoo changed the base branch from 15.0 to 17.0 October 16, 2025 14:54
@qsm-odoo qsm-odoo force-pushed the 15.0-assets_ignore_active-bso branch 2 times, most recently from e1e9445 to bbd456b Compare October 17, 2025 16:11
@qsm-odoo qsm-odoo changed the title [FIX] theme_*: use new asset tag [FIX] *: use new <asset> tag Oct 17, 2025
@qsm-odoo qsm-odoo force-pushed the 15.0-assets_ignore_active-bso branch from bbd456b to bafa34f Compare October 20, 2025 09:52
@qsm-odoo qsm-odoo marked this pull request as ready for review October 20, 2025 13:15
@qsm-odoo qsm-odoo force-pushed the 15.0-assets_ignore_active-bso branch from bafa34f to bb82fe5 Compare October 24, 2025 12:37
*: theme_anelusia, theme_artists, theme_avantgarde,
   theme_aviato, theme_beauty, theme_bewise, theme_bistro,
   theme_bookstore, theme_buzzy, theme_clean, theme_cobalt,
   theme_enark, theme_graphene, theme_kea, theme_kiddo,
   theme_loftspace, theme_monglia, theme_nano, theme_notes,
   theme_odoo_experts, theme_orchid, theme_paptic,
   theme_real_estate, theme_test_custo, theme_treehouse,
   theme_vehicle, theme_yes, theme_zap

See community commit for details.

task-2963840

Co-authored-by: qsm-odoo <[email protected]>
@qsm-odoo qsm-odoo force-pushed the 15.0-assets_ignore_active-bso branch from bb82fe5 to 04ab181 Compare October 24, 2025 12:41
Copy link
Contributor

@qsm-odoo qsm-odoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robodoo
Copy link
Collaborator

robodoo commented Oct 24, 2025

@bso-odoo @qsm-odoo linked pull request(s) odoo/documentation#14984 not ready. Linked PRs are not staged until all of them are ready.

robodoo pushed a commit to odoo/odoo that referenced this pull request Oct 24, 2025
*: test_website, base, web_editor, website, website_blog, website_event,
   website_mail_group, website_mass_mailing, website_payment,
   website_sale, test_assetsbundle

Before this commit when a module was updated all ir.asset records were
reset to their defined `active` state, if defined.
This causes assets related to old snippet versions to be made inactive
even if those old snippet versions are used inside existing pages.

It used to work when the activation of assets was made through view
inheritance because when views are defined through a `<template>` tag,
the `active` attribute is in fact ignored during updates since [1],
except for new records since [2].

This commit introduces an `<asset>` tag in the XML import format.
It is an alias of `<record ... model="ir.asset">` with the additional
feature that it avoids taking the `active` field into account during
updates for existing `ir_asset` records, just like `<template>` if the
`active` field is mentioned as attribute of the tag.
We then rely on the `website_disable_unused_snippets_assets` cron to
properly disable any unused asset at a later stage (note that the bug
being fixed here was mitigated by the fact that cron also re-enabled
assets which were disabled by mistake... but that might happen only a
few days later).

Another approach was to overload `_load_records_write` in `base`'s
`ir_asset.py` to avoid taking the `active` field into account when
updating records:
```py
    def _load_records_write(self, values):
        values.pop('active', None)
        super()._load_records_write(values)
```
But this is not as stable because it changes the way `ir.asset` records
are imported when the `<record>` tag is used. In the end we chose to be
consistent and do exactly the same as `<template>`, as this also allows
more and should be entirely stable.

[1]: 2d296cb#diff-175c28787c272a219b9275f79262a48af9aa029e718f45077fd609737559e84eR803-R804
[2]: f1c70d4#diff-175c28787c272a219b9275f79262a48af9aa029e718f45077fd609737559e84eR801-R804

task-2963840

closes #104836

Related: odoo/enterprise#35153
Related: odoo/documentation#14984
Related: odoo/design-themes#629
Signed-off-by: Quentin Smetz (qsm) <[email protected]>
Co-authored-by: qsm-odoo <[email protected]>
robodoo pushed a commit that referenced this pull request Oct 24, 2025
*: theme_anelusia, theme_artists, theme_avantgarde,
   theme_aviato, theme_beauty, theme_bewise, theme_bistro,
   theme_bookstore, theme_buzzy, theme_clean, theme_cobalt,
   theme_enark, theme_graphene, theme_kea, theme_kiddo,
   theme_loftspace, theme_monglia, theme_nano, theme_notes,
   theme_odoo_experts, theme_orchid, theme_paptic,
   theme_real_estate, theme_test_custo, theme_treehouse,
   theme_vehicle, theme_yes, theme_zap

See community commit for details.

task-2963840

closes #629

Related: odoo/odoo#104836
Related: odoo/enterprise#35153
Related: odoo/documentation#14984
Signed-off-by: Quentin Smetz (qsm) <[email protected]>
Co-authored-by: qsm-odoo <[email protected]>
robodoo pushed a commit to odoo/documentation that referenced this pull request Oct 24, 2025
Also removes outdated things in the `<template>` tag documentation and
reviews it a bit.

See odoo/odoo#104836

task-2963840

closes #14984

Related: odoo/odoo#104836
Related: odoo/enterprise#35153
Related: odoo/design-themes#629
Signed-off-by: Quentin Smetz (qsm) <[email protected]>
@robodoo robodoo closed this Oct 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants